<template>
	<view>
		<view class="navbar">
			<uni-nav-bar left-icon="back" backgroundColor="#C52B2E" title="个人信息" color="#FFFFFF" @clickLeft = "back">
			</uni-nav-bar>
		</view>
		<view class="" style="padding-top: 90rpx;">
			<view  class="header">
				<view class="box">
					<view class="">头像</view>
					<image :src="userInfo.avatar" mode="" class="touxiang"></image>
					<!-- <image src="../../../static/PersonalCenter/right.png" mode="" class="right"></image> -->
				</view>
			</view>
			<view class="header">
				<view class="xingbie">
					<view class="">性别</view>
					<view class="women">
						<view class="nv" v-show="userInfo.gender == 2">女</view>
						<view class="nv" v-show="userInfo.gender == 1">男</view>
						<!-- <image src="../../../static/PersonalCenter/right.png" mode="" class="right"></image> -->
					</view>
				</view>
			</view>
			
			<view class="header">
				<view class="xingbie">
					<view class="">昵称</view>
					<view class="women">
						<view class="nv">{{userInfo.nickname}}</view>
						<!-- <image src="../../../static/PersonalCenter/right.png" mode="" class="right"></image> -->
					</view>
				</view>
			</view>
			<view class="header">
				<view class="xingbie">
					<view class="">地区</view>
					<view class="women">
						<view class="nv">{{userInfo.province}}{{userInfo.city}}</view>
						<!-- <image src="../../../static/PersonalCenter/right.png" mode="" class="right"></image> -->
					</view>
				</view>
			</view>
			<!-- <view class="header">
				<view class="xingbie">
					<view class="">个新签名</view>
					<view class="women">
						<view class="nv">哈哈哈哈</view>
						<image src="../../../static/PersonalCenter/right.png" mode="" class="right"></image>
					</view>
				</view>
			</view> -->
			<!-- <view class="header">
				<view class="xingbie">
					<view class="">我的二维码</view>
					<view class="women">
						<image src="../../../static/PersonalCenter/code.png" mode="" class="code"></image>
						<image src="../../../static/PersonalCenter/right.png" mode="" class="right"></image>
					</view>
				</view>
			</view> -->
		</view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				userInfo: [],
				token: ''
			};
		},
		onShow() {
			this.getuserInfo()
		},
		onLoad() {
			this.token = uni.getStorageSync('token')
		},
		
		methods: {
			back(){
				uni.switchTab({
					url:'../users'
				})
			},
			// 获取用户信息
			async getuserInfo(){
				
				let that = this
				const res = await that.$myRequest({
					url: 'user/getUserInfo',
					method: "GET",
					header: {
						'token':  that.token
					},
					data: {
						
					}
					
				})
				if (res.data.code ==1) {
					that.userInfo = res.data.data
					// that.nickname = that.userInfo.nickname
				}
			}
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #EEEEEE;
	}
	.header {
		width: 100%;
		height: 120rpx;
		background-color: #FFFFFF;
		margin-bottom: 10rpx;
		.box {
		    display: flex;
			align-items: center;
			justify-content: space-between;
			padding: 15rpx 31rpx 0 30rpx;
			.touxiang {
				width: 83rpx;
				height: 83rpx;
				// padding-left: 450rpx;
				border-radius: 50%;
			}
			.right {
				width: 12rpx;
				height: 24rpx;
			}
		}
		.xingbie {
			display: flex;
			justify-content: space-between;
			padding: 30rpx 31rpx 0 30rpx;
			.women {
				display: flex;
				align-items: center;
				
				.nv {
					padding-right: 10rpx;
				}
				.right {
					width: 12rpx;
					height: 24rpx;
				}
				.code {
					width: 49rpx;
					height: 49rpx;
					padding-right: 35rpx;
				}
			}
			
			
		}
	}
	

</style>
